Skip to content

fix(StdCheats): exclude P256VERIFY precompile in assumeNotPrecompile - #927

Merged
mattsse merged 3 commits into
foundry-rs:masterfrom
maurelian:fix/assume-not-precompile-p256verify
Oct 23, 2026
Merged

mattsse merged 3 commits into
foundry-rs:masterfrom
maurelian:fix/assume-not-precompile-p256verify

Conversation

@maurelian

Copy link
Copy Markdown
Contributor

assumeNotPrecompile excludes 0x01–0xff, so fuzzers can still pick 0x100, the P256VERIFY precompile added in Osaka (EIP-7951). Tests that then vm.etch that address fail with "cannot use precompile 0x…0100". We found this running tests on the Amsterdam hardfork.

This widens the excluded range to 0x100, updates the testFuzz_AssumeNotPrecompile assertion, and adds test_AssumeNotPrecompileP256Verify, which uses the existing StdCheatsMock pattern. Both tests fail without the fix.

assumeNotPrecompile only excluded 0x01-0xff, so fuzzers could pick 0x100,
the P256VERIFY precompile added in Osaka (EIP-7951).
Comment thread test/StdCheats.t.sol
assumeNotPrecompile(addr, getChain("optimism_sepolia").chainId);
assertTrue(
addr < address(1) || (addr > address(9) && addr < address(0x4200000000000000000000000000000000000000))
addr < address(1) || (addr > address(0x100) && addr < address(0x4200000000000000000000000000000000000000))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expands the range a lot, but I think it's still reasonable to consider it "within the range of things that might become precompiles". Can change to just add 0x100 instead of expanding, if preferred.

@grandizzy grandizzy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mattsse
mattsse enabled auto-merge (squash) October 23, 2026 07:00
@mattsse
mattsse merged commit 4a0019b into foundry-rs:master Oct 23, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants